package com.example.spring_boot;

import com.example.spring_boot.bean.Dog;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.stereotype.Component;
import org.springframework.web.context.annotation.ApplicationScope;
import org.springframework.web.context.annotation.RequestScope;
import org.springframework.web.context.annotation.SessionScope;

@Component
public class DogBeanConfig {

    @Bean
    @Primary
    public Dog singletonDog(){
        Dog dog=new Dog();
        return dog;
    }

    @Bean
    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
    public Dog prototypeDog(){
        Dog dog=new Dog();
        return dog;
    }

    @Bean
    @RequestScope
    public Dog requestDog(){
        Dog dog=new Dog();
        return dog;
    }

    @Bean
    @SessionScope
    public Dog sessionDog(){
        Dog dog=new Dog();
        return dog;
    }
    @Bean
    @ApplicationScope
    public Dog ApplicationDog(){
        Dog dog=new Dog();
        return dog;
    }
}
